<?php

namespace Util;

class Account extends \Home {


    const ACCOUNT_COOKIE = 'account';

    public static function setAccountIdToCookie($accountId) {
        $str = Comm::encrypt($accountId);
        Comm::setCookie(self::ACCOUNT_COOKIE, $str);
    }

    public static function getAccountIdToCookie() {
        $str = isset($_COOKIE[self::ACCOUNT_COOKIE]) ? $_COOKIE[self::ACCOUNT_COOKIE] : null;
        if (!$str) {
            return;
        }
        $id = Comm::decrypt($str);
        return $id;
    }

    public static function delAccountIdToCookie() {
        Comm::setCookie(self::ACCOUNT_COOKIE, null , -1);
    }

}